www.gusucode.com > VC++网络版的打字软件源程序-源码程序 > VC++网络版的打字软件源程序-源码程序\code\TypeClt V2.0\ScoreView.cpp
// ScoreView.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "type.h" #include "ScoreView.h" #include "TypeDoc.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CScoreView IMPLEMENT_DYNCREATE(CScoreView, CListView) CScoreView::CScoreView() { } CScoreView::~CScoreView() { } BEGIN_MESSAGE_MAP(CScoreView, CListView) //{{AFX_MSG_MAP(CScoreView) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CScoreView drawing void CScoreView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // CScoreView diagnostics #ifdef _DEBUG void CScoreView::AssertValid() const { CListView::AssertValid(); } void CScoreView::Dump(CDumpContext& dc) const { CListView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CScoreView message handlers void CScoreView::OnInitialUpdate() { CListView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CListCtrl* pList=(CListCtrl*)&GetListCtrl(); pList->SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); pList->DeleteAllItems(); while(pList->DeleteColumn(0)); int i=0; pList->InsertColumn(i++,"序号",LVCFMT_LEFT,60); pList->InsertColumn(i++,"学号",LVCFMT_CENTER,100); pList->InsertColumn(i++,"姓 名",LVCFMT_CENTER,120); pList->InsertColumn(i++,"类型",LVCFMT_CENTER,60); pList->InsertColumn(i++,"正确率(%)",LVCFMT_CENTER,100); pList->InsertColumn(i++,"速度(字/分)",LVCFMT_CENTER,100); pList->InsertColumn(i++,"保存时间",LVCFMT_CENTER,180); CTypeDoc* pDoc=(CTypeDoc*)GetDocument(); SCOREDEF sd; CString str; for(i=0;i<pDoc->GetMaxScoreID();i++) { sd=pDoc->m_ScoreList[i]; str.Format("%d",i+1); pList->InsertItem(i,str); str=sd.strID; pList->SetItemText(i,1,str); str=sd.strName; pList->SetItemText(i,2,str); sd.nInputLanguage==0 ? str="英文" : str="中文"; pList->SetItemText(i,3,str); str.Format("%d",sd.nRate); pList->SetItemText(i,4,str); str.Format("%d",sd.nSpeed); pList->SetItemText(i,5,str); str=sd.strTime; pList->SetItemText(i,6,str); } } BOOL CScoreView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class dwStyle|=LVS_REPORT; return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); }